package com.qire.manhua.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.GridView;

/**
 * 完整显示的网格组件，填满显示内容，在屏幕可显示的情况下完整显示下控件内容，除非屏幕显示不下才会使用滚动方式
 */
public class FullShowGridView extends GridView {

    public FullShowGridView(Context context) {
        this(context, null);
    }

    public FullShowGridView(Context context, AttributeSet attrs) {
        this(context, attrs, android.R.attr.gridViewStyle);
    }

    public FullShowGridView(Context context, AttributeSet attrs, int defStyleAttr) {
        this(context, attrs, defStyleAttr, 0);
    }

    public FullShowGridView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
        super.onMeasure(widthMeasureSpec, expandSpec);
    }

}
